<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="s"%>
<%@	taglib prefix="m" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="ctx" value="${pageContext.request.contextPath}/" />
<meta charset="utf-8">
<title>高考服务在线系统</title>
<base href="${ctx}">
<link rel="Bookmark" href="${ctx}assets/favicon.ico">
<link rel="Shortcut Icon" href="${ctx}assets/favicon.ico" />
<script type="text/javascript">
  var ctx = "${ctx}";
</script>
<link rel="stylesheet" href="${ctx}/assets/assetadmin/css/index.css">
<script src="${ctx}assets/assetadmin/js/jquery-1.8.3.min.js"></script>
<script src="${ctx}assets/assetadmin/js/common.js"></script>
<script src="${ctx}assets/layer/latest/lay/layer/2.1/layer.js"></script>
<script src="${ctx}assets/admin/js/regxutils.js"></script>
<script src="${ctx}assets/plugins/layDate-v5.0.9/laydate/laydate.js"></script>
<script type="text/javascript">
  var basePath = "${ctx}";
  var ctx = "${ctx}";
  var ctxLess = ctx.substring(0, (ctx.length - 1));
  var debug = false;
  (function() {
    if (!window.debugs) {
      window.debugs = function(message) {
        try {
          if (!window.console) {
            window.console = {};
            window.console.log = function() {
              return;
            }
          }
          console.log(message);
        } catch (e) {
        }
      };
    }
  })();
  /**序列化表格 */
  $.fn.serializeObject = function() {
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
      if (o[this.name]) {
        if (!o[this.name].push) {
          o[this.name] = [ o[this.name] ];
        }
        o[this.name].push(this.value || '');
      } else {
        o[this.name] = this.value || '';
      }
    });
    return o;
  };

  /**
   * 获取年份的公共方法
   * startYear 开始年份 null为当前年份前10年
   * endYear 结束年份 null为当前年份
   */
  function getYearArr(startYear, endYear) {
    var yearArr = [];
    var myDate = new Date();
    //当前年
    nowYear = myDate.getFullYear();
    if (endYear) {
    } else {
      // 为空为当前年
      endYear = nowYear;
    }
    if (startYear) {
    } else {
      // 为空为当前年前10年
      startYear = nowYear - 10;
    }
    for (var cur = startYear; cur <= endYear; cur++) {
      yearArr.push(cur);
    }
    return yearArr;
  }

  /**检查是否为空*/
  function isEmpty(str) {
    return empty(str);
  }

  /**检查是否为空*/
  function empty(val) {
    // test results
    //---------------
    // []        true, empty array
    // {}        true, empty object
    // null      true
    // undefined true
    // ""        true, empty string
    // ''        true, empty string
    // 0         false, number
    // true      false, boolean
    // false     false, boolean
    // Date      false
    // function  false
    if (val === undefined)
      return true;

    if (typeof (val) == 'function' || typeof (val) == 'number'
        || typeof (val) == 'boolean'
        || Object.prototype.toString.call(val) === '[object Date]')
      return false;

    if (val == null || val.length === 0 || val === "" || val === " ") // null or 0 length array
      return true;

    if (typeof (val) == "object") {
      // empty object

      var r = true;

      for ( var f in val)
        r = false;

      return r;
    }
    return false;
  }
  /**检查是否不为空*/
  function isNotEmpty(str) {
    return !isEmpty(str);
  }

  function getTimeYMDStr(value) {
    if (value == null || value == "") {
      return "";//暂无操作
    }
    var date = new Date(value);
    return formatterDateTimeYmd(date);
  }

  function getTimeYMDHMSStr(value) {
    if (value == null || value == "") {
      return "";//暂无操作
    }
    var date = new Date(value);
    return formatterDateTime(date);
  }
  function getTimeYMDHMStr(value) {
    if (value == null || value == "") {
      return "";//暂无操作
    }
    var date = new Date(value);
    return formatterDateTimeYMDHMStr(date);
  }

  /** date类型转换成字符串显示 */
  function formatterDateTime(date) {
    var datetime = date.getFullYear()
        + "-"// "年"
        + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : "0"
            + (date.getMonth() + 1))
        + "-"// "月"
        + (date.getDate() < 10 ? "0" + date.getDate() : date.getDate())
        + " "
        + (date.getHours() < 10 ? "0" + date.getHours() : date.getHours())
        + ":"
        + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes())
        + ":"
        + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds());
    return datetime;
  }
  /** date类型转换成字符串显示 年月日时分 */
  function formatterDateTimeYMDHMStr(date) {
    var datetime = date.getFullYear()
        + "-"// "年"
        + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : "0"
            + (date.getMonth() + 1))
        + "-"// "月"
        + (date.getDate() < 10 ? "0" + date.getDate() : date.getDate())
        + " "
        + (date.getHours() < 10 ? "0" + date.getHours() : date.getHours())
        + ":"
        + (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes())
    /* + ":"
    + (date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds()); */
    return datetime;
  }

  /** date类型转换成字符串显示 */
  function formatterDateTimeYmd(date) {
    var datetime = date.getFullYear()
        + "-"// "年"
        + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : "0"
            + (date.getMonth() + 1)) + "-"// "月"
        + (date.getDate() < 10 ? "0" + date.getDate() : date.getDate());
    return datetime;
  }
  /**
   * 弹出错误信息
   */
  function alertError(webMessage) {
    layer.alert(webMessage, {
      title : [ '<fmt:message key="sys.error"/>', true ],
      icon : 2,
      skin : 'layer-ext-moon',
      closeBtn : 1
    });
  }

  /**
   * 弹出OK信息
   */
  function alertOk(webMessage) {
    layer.alert(webMessage, {
      title : [ '<fmt:message key="sys.message"/>', true ],
      icon : 1,
      skin : 'layer-ext-moon',
      closeBtn : 1
    });
  }

  function getHeadTd(name) {
    return '<td class="head"><span>' + name + '</span></td>';
  }

  function getHead(headArray) {
    var tr = "<tr>";
    $.each(headArray, function(index, item) {
      tr += getHeadTd(item);
    });
    tr += "</tr>";
    return tr;
  }

  function getValueTd(value) {
    return '<td>' + value + '</td>';
  }

  function getValueTr(valueArray) {
    var tr = "<tr>";
    $.each(valueArray, function(index, item) {
      //debugs("item[index]:"+item);
      //debugs(index+"item[index]:"+item[index]);
      tr += getValueTd(item);
    });
    tr += "</tr>";
    return tr;
  }
  /**权限类型*/
  function authTypeValueGetter(params) {
    if (null == params) {
      return "";
    } else if (params == 1) {
      return "<fmt:message key='menu'/>";
    } else if (params == 2) {
      return "<fmt:message key='button'/>";
    } else if (params == 3) {
      return "<fmt:message key='data'/>";
    }
    return "";
  }

  function filtUndef(value) {
    if (typeof (value) == "undefined") {
      return "";
    }
    return value;
  }

  function getStatus(status) {
    var result = "";
    if (status == "-1") {
      result = "<fmt:message key='Deletes'/>";
    } else if (status == "0") {
      result = "<fmt:message key='disable'/>";
    } else if (status == "1") {
      result = "<fmt:message key='available'/>";
    }
    return result;
  }

  function getYmdTime(value) {
    return getTimeYMDStr(value);
  }
  function getYmdHmsTime(value) {
    return getTimeYMDHMSStr(value);
  }
  function getYmdHmTime(value) {
    return getTimeYMDHMStr(value);
  }

  function getDefaultPageFoot() {
    var defaultPageFoot = '';//datapagefoot
    defaultPageFoot += '<li><a class="first orange2-text" id="firstPage" href="javascript:void(0);"><fmt:message key="sys.home"/></a></li>';
    //<li><a class="next orange-text orange-border" id="pagesNextPage" href="javascript:void(0);"><fmt:message key="member.nextPage"/></a></li>
    defaultPageFoot += '<li>共<label class="num"  id="pagesPageCount">0</label>页，每页<label class="num">10</label>条，';
    defaultPageFoot += '到第<input type="text" id="pageNumers" name="pageNumber" value="1" maxlength="9" onpaste="return false;" class="num" />页';
    defaultPageFoot += '<span class="confirm orange2-text orange2-border"  onclick="listFormPageSearch(1)"><fmt:message key="determine"/></span></li>';
    return defaultPageFoot;
  }
  /*获取page页尾*/
  function getPageFoot(pages) {
    var pageFoot = '';
    pageFoot += '<li><a class="first orange2" id="firstPage" href="javascript:void(0);" onclick="listFormPageSearch(1)"><fmt:message key="sys.home"/></a></li>';
    if (pages.pageCount > 1) {
      if (pages.pageNumber > 1) {
        pageFoot += '<li><a class="next orange2-text orange2-border" id="previousPage" href="javascript:void(0);" onclick="listFormPageSearch('
            + (pages.pageNumber - 1) + ')">上一页</a></li>';
      }
      if (pages.pageNumber < pages.pageCount) {
        pageFoot += '<li><a class="next orange2-text orange2-border" id="pagesNextPage" href="javascript:void(0);" onclick="listFormPageSearch('
            + (pages.pageNumber + 1)
            + ')"><fmt:message key="member.nextPage"/></a></li>';
      }
      if (pages.pageNumber <= pages.pageCount) {
        pageFoot += '<li><a class="next orange2-text orange2-border" id="pagesNextPage" href="javascript:void(0);" onclick="listFormPageSearch('
            + (pages.pageCount)
            + ')"><fmt:message key="member.fastPage"/></a></li>';
      }
    }
    //debugs("pages.pageCount:");
    //debugs(pages.pageCount);
    //<fmt:message key="sys.page"><fmt:param value="'+pages.total+'"/><fmt:param  value="'+pages.pageSize+'"/></fmt:message>
    //共{0}条,{1}页,每页{2}条,跳转到第{3}

    pageFoot += '<fmt:message key="sys.page"><fmt:param value="'+pages.total+'"/><fmt:param  value="'+pages.pageCount+'"/><fmt:param  value="'+pages.pageSize+'"/></fmt:message>';
    // 	 pageFoot += '<li>共<label class="num" id="pagesPageCount">'+pages.total+'</label>条 , <label class="num" id="pagesPageCount">'+pages.pageCount+'</label>页，每页<label class="num">'+pages.pageSize+'</label>条，';
    // 	pageFoot += '<input id="pageNumers" name="pageNumber" value="'+pages.pageNumber+'" maxlength="9" onpaste="return false;" />/'+pages.pageCount;
    pageFoot += '<input type="hidden" id="pageCounts" name="pageCount" value="'+pages.pageCount+'" maxlength="9" onpaste="return false;" />';
    pageFoot += '<input type="text" id="pageNumers" name="pageNumber" value="'+pages.pageNumber+'"  maxlength="9" onpaste="return false;" class="num" />/'
        + pages.pageCount + '<fmt:message key="page.page"></fmt:message>';

    pageFoot += '<span class="confirm orange2-text orange2-border"  onclick="listFormPageSearch()"><fmt:message key="determine"/></span></li>';

    /* pageFoot += '<li>共<label class="num" id="pagesPageCount">'+pages.total+'</label>条 , <label class="num" id="pagesPageCount">'+pages.pageCount+'</label>页，每页<label class="num">'+pages.pageSize+'</label>条，';
    //pageFoot += '<input id="pageNumers" name="pageNumber" value="'+pages.pageNumber+'" maxlength="9" onpaste="return false;" />/'+pages.pageCount;
    pageFoot += '<input type="hidden" id="pageCounts" name="pageCount" value="'+pages.pageCount+'" maxlength="9" onpaste="return false;" />';
    pageFoot += '跳转到第<input type="text" id="pageNumers" name="pageNumber" value="'+pages.pageNumber+'"  maxlength="9" onpaste="return false;" class="num" />/'+pages.pageCount+'页';
    pageFoot += '<span class="confirm orange2-text orange2-border"  onclick="listFormPageSearch()"><fmt:message key="determine"/></span></li>'; */

    return pageFoot;
  }

  /**获取seachr json查詢*/
  function getSearchMapJson(pageForm) {
    var searchMap = [];
    $.each(pageForm, function(name, value) {
      if (name.indexOf('searchMap') >= 0) {
        var searchMapMeta = {};
        delete pageForm[name];
        var name2 = name.replace("searchMap.", "");
        searchMapMeta[name2] = value;
        searchMap.push(name2 + "," + value);
      }
    });
    debugs(searchMap);
    return searchMap;
  }

  /**纠正页码问题 */
  function checkPageNumber(pageForm, pageNum) {
    if (null != pageNum && pageNum != undefined && isNumber(pageNum)) {
      pageForm.pageNumber = pageNum;
    } else if (!(pageForm.pageNumber != null && isNumber(pageForm.pageNumber))) {
      pageForm.pageNumber = 1;
      $("#pageNumber").val(1);
    }

    var pageCounts = pageForm.pageCount;
    if (isNotEmpty(pageCounts)
        && (Number(pageCounts) <= 0
            || Number(pageCounts) < Number(pageForm.pageNumber) || (pageForm.pageNumber) < 1)) {
      alertError("<fmt:message key='Please.enter.the.reasonable.scope.of.the.page'/>!");
      // 直接return无效，重新回到第1页。
      pageForm.pageNumber = 1;
      $("#pageNumber").val(1);
    }
  }

  window.onkeydown = function(e) {
    if (e.keyCode == 9) {
      return false;
    }
  }
</script>
<style>
.must, .error {
    color: red;
}

.small {
    font-size: 10px;
}
</style>
